# Maintainer: Felix Yan <felixonmars@archlinux.org>

pkgname=golang-github-stretchr-testify
pkgver=1.7.0
pkgrel=1
pkgdesc='A toolkit with common assertions and mocks that plays nicely with the standard library'
arch=('any')
url="https://github.com/stretchr/testify"
license=('MIT')
depends=('go' 'golang-github-davecgh-go-spew' 'golang-github-pmezard-go-difflib'
         'golang-github-stretchr-objx' 'golang-gopkg-yaml.v3')
source=("$pkgname-$pkgver.tar.gz::https://github.com/stretchr/testify/archive/v$pkgver.tar.gz")
sha512sums=('8a8cff3ab5fba49a6bf9258cbf8c6110deec0644bfc66f665a99de33d96cbe62628c5d7f92afd0f96cc39408e69f6a227a5902b453868898a8ddc755f95d1642')

check() {
  export GO111MODULE=off
  export GOPATH="$srcdir/build:/usr/share/gocode"
  mkdir -p "$srcdir"/build/src/github.com/stretchr
  cp -a "$srcdir"/testify-$pkgver "$srcdir"/build/src/github.com/stretchr/testify
  cd "$srcdir"/build/src/github.com/stretchr/testify
  go test -v $(go list ./...)
}

package() {
  mkdir -p "$pkgdir"/usr/share/gocode/src/github.com/stretchr
  cp -a "$srcdir"/testify-$pkgver "$pkgdir"/usr/share/gocode/src/github.com/stretchr/testify

  install -Dm644 testify-$pkgver/LICENSE "$pkgdir"/usr/share/licenses/$pkgname/LICENSE
}
